package com.jishuhe.controller;

import com.jishuhe.domain.Book;
import com.jishuhe.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/books")
public class BookController {

    @Autowired
    private BookService bookService;

    @GetMapping
    public Book hello(){
        return new Book(1,"sas","sas","sas");
    }

    @GetMapping("/{id}")
    public Book getBookById(Integer id){
        return bookService.selectBookById(id);
    }
}
